package club.baimahu.pencil.domain.entity.account;

import java.math.BigDecimal;

/**
 * 现金类账户,不可透支
 */
public class CashAccount implements Account{

    BigDecimal balance;

    String accountName;

    public CashAccount(String name , BigDecimal balance){
        this.accountName = name;
        this.balance = balance;
    }

    int order;

    public void setOrder(int order){
        this.order = order;
    }


    @Override
    public BigDecimal balance() {
        return this.balance;
    }

    @Override
    public String accountName() {
        return this.accountName;
    }

    @Override
    public void increase(BigDecimal bigDecimal) {
        balance = balance.add(bigDecimal);
    }

    @Override
    public void decrease(BigDecimal bigDecimal) {
        balance = balance.subtract(bigDecimal);
    }


    @Override
    public int getOrder() {
        return this.order;
    }
}
